﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="ZX.WebApp.EHR.hrAddResume" Codebehind="hrAddResume.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>简历上传</title>
  <script type="text/javascript">
      function addFile() {
          var div = document.createElement("div");
          var f = document.createElement("input");
          f.setAttribute("type", "file")
          f.setAttribute("name", "File")
          f.setAttribute("size", "50")
          div.appendChild(f)
          var d = document.createElement("input");
          d.setAttribute("type", "button")
          d.setAttribute("onclick", "deteFile(this)");
          d.setAttribute("value", "移除");
          div.appendChild(d);
          document.getElementById("_container").appendChild(div);
      }

      function deteFile(o) {
          while (o.tagName != "DIV") o = o.parentNode;
          o.parentNode.removeChild(o);
      }

      function checkFileType() {
          //得到上传文件的值
          var files = document.getElementsByName("file");
          for (var i = 0; i < files.length; i++) {
              var fileName = files[i].value;
              //返回String对象中子字符串最后出现的位置.   
              var seat = fileName.lastIndexOf(".");
              //返回位于String对象中指定位置的子字符串并转换为小写.   
              var extension = fileName.substring(seat).toLowerCase();
              var allowed = new Array(".htm", ".html");
              var extFlag = false;
              for (var j = 0; j < allowed.length; j++) {
                  if (allowed[j] == extension) {
                      extFlag = true;
                  }
              }
              if (!extFlag) {
                  document.getElementById("flag").value = "1";
                  alert("文件类型不允许！");
                  return false;
              }
          }
          return true;
      }
  </script>
</head>
<body>
  <form id="form1" runat="server" method="post" enctype="multipart/form-data">
  <br />
  <table>
  <tr>
   <td>申请岗位：</td>
   <td><select id="ApplyPosition" name="ApplyPosition" style="width: 156px" title=""></select></td>
  </tr>
  <tr>
   <td>简历上传：</td>
  </tr>
  <tr>
   <td>&nbsp;&nbsp;</td>
   <td>
    <div>
       <input type="button" value="继续添加文件" onclick="addFile()" />
       <asp:Button runat="server" Text="开始上传" ID="UploadButton" 
        onclick="UploadButton_Click" OnClientClick="checkFileType();"></asp:Button>
    </div>
    <br />
  <div id="_container">
    <input type="file" size="50" name="File" />
      <input id="flag" name="flag" type="hidden" value="0" runat="server" />
  </div>
  <br />
  <div>
    <asp:Label ID="strStatus" runat="server" Font-Names="宋体" Font-Bold="True" Font-Size="9pt"
      Width="500px" BorderStyle="None" BorderColor="White"></asp:Label>
  </div>
  </td>
  </tr>
  </table>
  </form>
</body>
</html>
